package game;

import system.Game;
import system.ScoreHandler;

public class Gigatron extends Game{

	private static final long serialVersionUID = 1L;

	public String name = "";
	private int currentLevel = 1;

	public GameOver GO;
	public Scroller S;
	public Title T;
	public HighScores HS;


	public Gigatron(){
		super();
		/* prior we had these set via currentScene = GO (e.g.,) 
		 * but to reset the scene we actually need to just create
		 * a new scene each time. keeping this in case we decide
		 * to go this route again down the road.
		 * 
		 * 		GO = new GameOver(this, inputs, jukebox);
		 *		S = new Scroller(this, inputs, jukebox, 1);
		 *		HS = new HighScores(this, inputs, jukebox);
		 */

		setState(GAME_SPLASH);
	}


	@Override 
	public void setState(int state){

		super.setState(state);

		jukebox.StopAll();
		// change the Scene accordingly
		switch(state){
		case GAME_OVER: {
			currentScene = new GameOver(this, inputs, jukebox);
			jukebox.Play("bgm-gameover.wav");
			break;
		}
		case GAME_START: {
			currentScene = new Title(this, inputs, jukebox);
			break;
		}
		case GAME_RUN: {
			currentScene = new Scroller(this, inputs, jukebox, currentLevel);
			jukebox.Play("bgm-play.wav");
			break;
		}
		case GAME_HIGHSCORES: {
			currentScene = new HighScores(this, inputs, jukebox);
			jukebox.Play("bgm-topscores.wav");
			break;
		}
		case GAME_SPLASH: {
			currentScene = new Splash(this, inputs, jukebox);
			break;
		}
		}

	}

	public static void main(String[] args) {
		ScoreHandler.readIP();
		Gigatron GT = new Gigatron();
		windowStart(GT);

	}

	public void setCurrentLevel(int newLevel){
		this.currentLevel = newLevel;
	}

	public int getCurrentLevel(){
		return currentLevel;
	}

	public void setPlayerName(String name){
		this.name = name;
	}
	public String getPlayerName(){
		return name;
	}
}
